using UnityEngine;
using UnityEngine.UI;
using QFramework;

namespace QFramework.Adventure
{
	public class GameVictoryrPanelData : UIPanelData
	{
	}
	public partial class GameVictoryrPanel : UIPanel,IController
	{
		protected override void OnInit(IUIData uiData = null)
		{
			mData = uiData as GameVictoryrPanelData ?? new GameVictoryrPanelData();
			// please add init code here
		}
		
		protected override void OnOpen(IUIData uiData = null)
		{
            AudioKit.PlaySound(GameConfig.Auido_Victory);
            UIEventTrigger.Get(btn_newGame).onClick = NewGameFun;
            UIEventTrigger.Get(btn_exit).onClick = ExitFun;
            InputController.Instance.InputSTop = true;
            Time.timeScale = 0;
        }
		
		protected override void OnShow()
		{
		}
		
		protected override void OnHide()
		{
		}
		
		protected override void OnClose()
		{
            UIEventTrigger.Get(btn_newGame).onClick = null;
            UIEventTrigger.Get(btn_exit).onClick = null;

            Time.timeScale = 1;
            InputController.Instance.InputSTop = false;
        }
        //================>
        private void NewGameFun(GameObject go)
        {
            AudioKit.PlaySound(GameConfig.Auido_Btn01);

            UIKit.OpenPanel<LoadingPanel>(new LoadingPanelData() { sceneName = QAssetBundle.Level01_unity.LEVEL01 });               
            GameData.loadState = LoadState.NEWGAME;
            CloseSelf();
        }
        private void ExitFun(GameObject go)
        {
            AudioKit.PlaySound(GameConfig.Auido_Btn01);

            UIKit.ClosePanel<PlayerControllerPanel>();
            UIKit.OpenPanel<UnLoadingPanel>();
            UIKit.OpenPanel<MainMenuPanel>();
            CloseSelf();
        }
        public IArchitecture GetArchitecture()
        {
            return AdventureApp.Interface;
        }
    }
}
